<template>
  <div class="view-container">
    <header class="view-header">
      <div class="header-container">
        <div class="header-title">
          <i class="el-icon-s-grid"></i>
          <span>工程招标</span>
        </div>
        <div class="header-form">
          <div class="header-form-item">
            <el-dropdown @command="handleCommand">
              <el-button type="default" :loading="delLoading">
                更多<i class="el-icon-arrow-down el-icon--right"></i>
              </el-button>
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item icon="el-icon-refresh-right" class="color-refresh-item" command="refresh">刷新</el-dropdown-item>
                <el-dropdown-item icon="el-icon-edit" class="color-edit-item" command="edit">编辑</el-dropdown-item>
                <el-dropdown-item icon="el-icon-delete" class="color-del-item" command="del">{{isBatchesDel}}</el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
          </div>
          <div class="head-form-item">
            <el-button @click="openChildDialog">添加</el-button>
          </div>
        </div>
      </div>
    </header>
    <section class="table-container view-section">
      <!--
      banLiLeiXing: "集中"
      bdm: "SL201903-KC1"
      bdmName: "徐州市不牢河上段治理工程勘察设计标段"
      biaoDi: 230.5011
      chae: "2.376300"
      creator: 3
      daiLiDanWei: "徐州市通源招标代理有限公司"
      faBaoFangShi: "公开招标"
      faBaoRen: "徐州市水利局"
      faBuTime: null
      kaiBiaoTime: "2017-06-13T00:00:00"
      projectCode: "SL201903"
      remarks: ""
      status: "A"
      sysCreated: "2019-04-11T16:59:41.99"
      zbPrice: 228.1248
      zhaoBiaoId: 1018
      zhaoBiaoType: null
      zhongBiaoRen: "徐州市水利建筑设计研究院与江苏省水文水资源勘测局徐州分局组成的联合体"
      zym: "KC"
      -->
      <el-table
        ref="table"
        :data="tableData"
        stripe
        border
        @selection-change="handleSelectionChange"
        @row-click="handleRowClick"
      >
        <el-table-column type="selection" align="center"/>
        <el-table-column label="序号" align="center" width="50">
          <template slot-scope="scope">
            {{ (scope.$index+1)+(page.index-1)*page.size }}
          </template>
        </el-table-column>
        <el-table-column prop="bdm" label="招标码" align="center" sortable width="100"/>
        <el-table-column label="招标名称"  sortable >
          <template slot-scope="s">
            <el-link v-text="s.row.bdmName" @click="showDetail(s.row.zhaoBiaoId)"></el-link>
          </template>
        </el-table-column>
        <el-table-column prop="zhongBiaoRen" label="中标人" align="center" sortable />
        <el-table-column prop="faBaoFangShi" label="发包方式" align="center" sortable width="110"/>
        <el-table-column prop="biaoDi" label="招标控制价(万元)" align="center"  sortable width="150"/>
        <el-table-column prop="zbPrice" label="中标价(万元)" align="center"  sortable width="130"/>
        <el-table-column prop="chae" label="差额(万元)" align="center"  sortable width="120"/>
      </el-table>
    </section>
    <footer>
      <el-pagination
        :page-sizes="[10, 20, 50, 100]"
        style="text-align: right"
        layout="total, sizes, prev, pager, next, jumper"
        :total="page.total"
        :page-size="page.size"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
      />
    </footer>

    <add-page ref="child"></add-page>
    <detail-page ref="detail-child"></detail-page>
  </div>
</template>

<script>
  import projectDetailAPI from '@/api/project/projectDetail'
  import listMixin from '@/mixin/listMixin'
  import addPage from './components/ZhaoBiaoCpn'
  import detailPage from './components/ZhaoBiaoDetail'
  export default {
    name: 'ZhaoBiao',
    mixins:[listMixin],
    components:{addPage,detailPage},
    data() {
      return {
        proId:this.$route.params.proId,
        mixinParams: {
          addUrl: '/gui-zhang-zhi-du/save',
          editUrl: '/gui-zhang-zhi-du/edit/',
          propertyName: 'zhaoBiaoId',
          API: projectDetailAPI,
          deleteMethod:'zhaoBiaoDelete'
        },
      }
    },
    created() {
    },
    methods: {
      fetchData(){
        projectDetailAPI.zhaoBiaoList(this.proId,this.page).then(res=>{
          console.log(res)
          this.tableData = res.records
          this.page.total = res.total
        })
      },
      openChildDialog(){
        this.$refs['child'].open()
      },
      showDetail(){
        this.$refs['detail-child'].open()
      }
    }
  }
</script>

<style scoped lang="scss">

</style>
